﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations
{
    public partial class Update_To_fwyg_201809051541 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "FactoryinfoId",
                table: "SettlementInfo",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "CapitalAccountId",
                table: "ReceiptInfo",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<DateTime>(
                name: "DateofPayment",
                table: "ReceiptInfo",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "FactoryinfoId",
                table: "ReceiptInfo",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "PaymentPerson",
                table: "ReceiptInfo",
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "PaymentPersonUserId",
                table: "ReceiptInfo",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "RestaurantId",
                table: "ReceiptInfo",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "FactoryinfoId",
                table: "PrePaymentInfo",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "FactoryinfoId",
                table: "PaymentInfo",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "IX_ReceiptInfo_RestaurantId",
                table: "ReceiptInfo",
                column: "RestaurantId");

            migrationBuilder.AddForeignKey(
                name: "FK_ReceiptInfo_RestaurantInfo_RestaurantId",
                table: "ReceiptInfo",
                column: "RestaurantId",
                principalTable: "RestaurantInfo",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ReceiptInfo_RestaurantInfo_RestaurantId",
                table: "ReceiptInfo");

            migrationBuilder.DropIndex(
                name: "IX_ReceiptInfo_RestaurantId",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "FactoryinfoId",
                table: "SettlementInfo");

            migrationBuilder.DropColumn(
                name: "CapitalAccountId",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "DateofPayment",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "FactoryinfoId",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "PaymentPerson",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "PaymentPersonUserId",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "RestaurantId",
                table: "ReceiptInfo");

            migrationBuilder.DropColumn(
                name: "FactoryinfoId",
                table: "PrePaymentInfo");

            migrationBuilder.DropColumn(
                name: "FactoryinfoId",
                table: "PaymentInfo");
        }
    }
}
